﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    
    public class MyDbContext:DbContext
    {
        //连接字符串
        private string _conn = "Data Source=.;Initial Catalog=Renovation;Persist Security Info=True;User ID=sa;Password=123456;Pooling=False;Encrypt=True;Trust Server Certificate=True";
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(_conn);
        }

        /// <summary>
        /// 员工的数据集
        /// </summary>
        public DbSet<Employee> Employees { get; set; }
        /// <summary>
        /// 角色数据集
        /// </summary>
        public DbSet<RoleInfo> RoleInfo { get; set; }
        /// <summary>
        /// 材料数据集
        /// </summary>
        public DbSet<Material> Materials { get; set; }
        /// <summary>
        /// 订单数据集
        /// </summary>
        public DbSet<Orders> Orders { get; set; }
        /// <summary>
        /// 订单材料中间表数据集
        /// </summary>
        public DbSet<OrdersMaterial> OrdersMaterials { get; set; }
    }
}
